import { DatePicker as AntdDatePicker } from 'antd';
import React from 'react';
import {
  DatePickerIcon,
  DatePickerMonthLeftArrow,
  DatePickerMonthRightArrow,
  DatePickerYearLeftArrow,
  DatePickerYearRightArrow,
} from '../Svg';
import MonthPicker from './MonthPicker';
import QuarterPicker from './QuarterPicker';
import RangePicker from './RangePicker';
import TimePicker from './TimePicker';
import WeekPicker from './WeekPicker';
import YearPicker from './YearPicker';

// type
import type { DatePickerProps as AntdDatePickerProps } from 'antd';
import type { RangePickerProps } from 'antd/lib/date-picker';
import type { Dayjs } from 'dayjs';

export { en_GB, en_US, zh_CN, zh_TW } from './locale';

export const commonProps = {
  suffixIcon: <DatePickerIcon />,
  prevIcon: <DatePickerMonthLeftArrow />,
  nextIcon: <DatePickerMonthRightArrow />,
  superPrevIcon: <DatePickerYearLeftArrow />,
  superNextIcon: <DatePickerYearRightArrow />,
};

export type AntdMonthPickerProps = Omit<AntdDatePickerProps<Dayjs>, 'picker'>;
export type AntdWeekPickerProps = Omit<AntdDatePickerProps<Dayjs>, 'picker'>;
export type AntdYearPickerProps = Omit<AntdDatePickerProps<Dayjs>, 'picker'>;
export type AntdTimePickerProps = Omit<AntdDatePickerProps<Dayjs>, 'picker'>;
export type AntdQuarterPickerProps = Omit<AntdDatePickerProps<Dayjs>, 'picker'>;
export type AntdRangePickerProps = RangePickerProps;

export type DatePickerProps = AntdDatePickerProps;

function DatePicker(props: DatePickerProps) {
  return <AntdDatePicker {...props} />;
}

DatePicker.YearPicker = YearPicker;
DatePicker.MonthPicker = MonthPicker;
DatePicker.TimePicker = TimePicker;
DatePicker.WeekPicker = WeekPicker;
DatePicker.QuarterPicker = QuarterPicker;
DatePicker.RangePicker = RangePicker;

export default DatePicker;
